/* 
Copyright DAUPHIN Maxime 2005

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
http://www.gnu.org/licenses/gpl.txt
*/
#ifndef __GUI_H__
#define __GUI_H__

#include <windows.h>
#include <string>
#include <assert.h>
#include <vector>
#include <map>
#include <sstream>
#include <typeinfo>

#ifdef  UNICODE
	#define STRING	std::wstring
	#define STRINGSTREAM std::wstringstream
	#define _T(quote) L##quote
	inline std::wstring conversion( std::string string )
	{
	  size_t size = string.size() + 1;
	  wchar_t *buf = new wchar_t[ size * sizeof (wchar_t)];
	  size = mbstowcs (buf, string.c_str(), size);
	  std::wstring ret = buf;
	  delete []buf;
	  return ret;
	}
#else
	#define STRING  std::string
	#define STRINGSTREAM std::stringstream
	#define _T(quote)	quote
	inline std::string conversion( std::string string )
	{
		return string;
	}
#endif

namespace Gui {
	class ClipBoard;
	class Dc;
	class Point;
	class Rect;
	class Image;
	class Static;
	class Wnd;
	class Bitmap;
	class DropFile;
	class Object{};

	typedef unsigned char byte;
	typedef unsigned int uint;

	inline int iround(const double x) 
	{
		return ( x>=0 ? static_cast<int>(x + 0.5) : static_cast<int>(x + 0.5) );
	}

	inline STRING getShortFileName(const STRING fullFileName)
	{
		size_t pos = fullFileName.find_last_of("\\");
		assert( pos != STRING::npos );
		return fullFileName.substr( pos+1, fullFileName.size() );
	}
#ifdef  UNICODE
	static const bool g_unicode = true;
#else
	static const bool g_unicode = false;
#endif
};





#endif //#define __GUI_H__